/*
============================================================================
 Name        : C$(Basename)AppUi from $(Basename)Appui.cpp
 Author      : $(Author)
 Version     :
 Copyright   : $(Copyright)
 Description : C$(Basename)AppUi implementation
============================================================================
*/

// INCLUDE FILES
#include "$(Basename)Appui.h"
#include "$(Basename)Container.h" 
#include <$(Basename).rsg>
#include "$(Basename).hrh"

#include <avkon.hrh>
#include <aknnotewrappers.h>

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// C$(Basename)AppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void C$(Basename)AppUi::ConstructL()
	{
	BaseConstructL();

	iAppContainer = new (ELeave) C$(Basename)Container;
	iAppContainer->SetMopParent( this );
	iAppContainer->ConstructL( ClientRect() );
	AddToStackL( iAppContainer );
	}

// ----------------------------------------------------
// C$(Basename)AppUi::~C$(Basename)AppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
C$(Basename)AppUi::~C$(Basename)AppUi()
	{
	if (iAppContainer)
		{
		RemoveFromStack( iAppContainer );
		delete iAppContainer;
		}
   }

// ------------------------------------------------------------------------------
// C$(Basename)AppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void C$(Basename)AppUi::DynInitMenuPaneL(
	TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
	{
	}

// ----------------------------------------------------
// C$(Basename)AppUi::HandleKeyEventL(
//  const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse C$(Basename)AppUi::HandleKeyEventL(
	const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
	{
	return EKeyWasNotConsumed;
	}

// ----------------------------------------------------
// C$(Basename)AppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void C$(Basename)AppUi::HandleCommandL(TInt aCommand)
	{
	switch ( aCommand )
		{
		case EAknSoftkeyBack:
		case EEikCmdExit:
			{
			Exit();
			break;
			}
		case E$(Basename)CmdAppTest:
			{
			// Info message shown only in the emulator
			iEikonEnv->InfoMsg(_L("test"));
			
			// Load localized message from the resource file
			HBufC* message = CEikonEnv::Static()->AllocReadResourceLC(R_MESSAGE_TEXT);
			// Show information note dialog
			CAknInformationNote* note = new (ELeave) CAknInformationNote;
			note->ExecuteLD(message->Des());
			CleanupStack::PopAndDestroy(message);
			break;
			}

			// TODO: Add Your command handling code here

		default:
			break;	  
		}
	}
